package cn.com.justing.pigeon.feed;

import java.util.Date;

import junit.framework.TestCase;

public class FeedFetcherImplTest extends TestCase
{
	FeedFetcherImpl fetcherImpl;

	protected void setUp() throws Exception
	{
		super.setUp();
		fetcherImpl = new FeedFetcherImpl("justing.xml");
	}

	public void testFindNewItems()
	{
		fetcherImpl.setUpdatedDate(new Date(Date
				.parse("24 Mar 2010 16:32:50 GMT")));
		assertEquals(0, fetcherImpl.getNewFeeds().size());

		fetcherImpl.setUpdatedDate(new Date(Date
				.parse("24 Mar 2010 16:32:49 GMT")));
		assertEquals(0, fetcherImpl.getNewFeeds().size());

		fetcherImpl.setUpdatedDate(new Date(Date
				.parse("24 Mar 2010 16:32:48 GMT")));
		assertEquals(1, fetcherImpl.getNewFeeds().size());

		fetcherImpl.setUpdatedDate(new Date(Date
				.parse("24 Mar 2010 16:30:43 GMT")));
		assertEquals(1, fetcherImpl.getNewFeeds().size());

		fetcherImpl.setUpdatedDate(new Date(Date
				.parse("24 Mar 2010 16:14:56 GMT")));
		assertEquals(5, fetcherImpl.getNewFeeds().size());

	}

}
